package com.laker.autotest.testcase;

import com.laker.autotest.core.BasePageTest;
import com.laker.autotest.page.baidu.BaiduHomePage;
import com.laker.autotest.utils.EasyCsvUtil;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

import java.util.List;

/**
 * 数据驱动示例
 */
public class BaiduPageTest extends BasePageTest {

    @Test(dataProvider = "searchKeywords")
    @Ignore
    public void search(String kw, String expect) {
        BaiduHomePage baiduHomePage = new BaiduHomePage(page);
        baiduHomePage.search(kw);
        List<String> resultRowTitles = baiduHomePage.getSearchResultRowTitles();
        Assert.assertTrue(resultRowTitles.contains(expect));
    }

    @DataProvider(name = "searchKeywords")
    public Object[][] searchKeywords() {
        return EasyCsvUtil.getTestDataFromCsv("data/baidu.csv");
    }

}
